package com.smh.a04ZhengZedemo4;

import java.util.Objects;

public class Test {
    public static void main(String[] args) {
//        Regex
        String qq = "2697719640";
        System.out.println(checkQQ(qq));
        String regex = "[1-9]\\d{5,19}";
        System.out.println(qq.matches(regex));

        System.out.println("15933883796".matches("1[3-9][0-9]{9}"));
        System.out.println("15933883796".matches("1[3-9]\\d{9}"));

        System.out.println("020-12313".matches("0\\d{2,3}-{0,1}[1-9]\\d{4,9}"));

        "2697719640@qq.com".matches("\\w+@[\\w&&[^_]]{2,6}(\\.[a-zA-Z]{2,3}]){1,2}");

        String s = "^[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]$";

    }

    public static boolean checkQQ(String qq) {
        int len = qq.length();
        if (Objects.equals(qq.charAt(0), '0')) {
            return false;
        }

        if (len >= 6 && len < 20) {

        } else {
            return false;
        }
        for (int i = 0; i < qq.length(); i++) {
            if (qq.charAt(i) < '0' || qq.charAt(i) > '9') {
                return false;
            }
        }

        return true;

    }
}
